package mybatisplus.spring.boot.admin.business.user.controller;


import mybatisplus.spring.boot.admin.business.user.bo.UserQueryBO;
import mybatisplus.spring.boot.admin.business.user.entity.User;
import mybatisplus.spring.boot.admin.business.user.service.IUserService;
import mybatisplus.spring.boot.admin.business.user.vo.UserQueryVO;
import mybatisplus.spring.boot.admin.common.base.JsonResVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统用户表 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2019-06-21
 */
@RestController
@RequestMapping("/user/")
public class UserController {
    @Autowired
    private IUserService iUserService;

    @PostMapping("/queryUser")
    public JsonResVo queryUser(@RequestBody @Validated UserQueryBO bo){
        User user = iUserService.getById(bo.getId());
        UserQueryVO userQueryVO = UserQueryVO.builder()
                .age(user.getAge())
                .name(user.getName())
                .createTime(user.getCreateTime()).build();
        return JsonResVo.buildSuccess(userQueryVO);
    }
}
